<?
$nombre=30;
if (!$_GET['compta_releve_debut'])
{
$_GET['compta_releve_debut']="0";
}
?>
<style type="text/css">
<!--
.champs {	font-size: x-small;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
-->
</style>

<br> 

<?
print mklink_simple("pop.form.make_cpt_wizard.php", 900, 450, 20, 20, "Wizard_comptable")."<img  src=\"../images/actg_15.gif\"  border=\"0\" Title=\"Saisir mouvement cpt\" alt=\"Saisir mouvement cpt\">WIZARD (95% fonctionnel)</a>";
?>
<table width="200" border="1">
		<tr>
				<td><form name="form1" method="get" action="">
		Actifs
		<? mk_list_table_class("compta_compte","","SELECT * FROM `cpt_comptes` WHERE (type LIKE 'Actif' AND groupe= '0') AND ( type LIKE 'Actif' AND no_pos_5!= '0') ORDER BY `no_pos_1`,`no_pos_2`,`no_pos_3`,`no_pos_4`,`no_pos_5`,`no_pos_6`,`no_pos_7`,`no_pos_8`,`no_pos_9` ", "no", "libelle_admin", $db, FALSE, "champs"); ?>
		<input type="submit" name="Submit" value="voir">
</form></td>
				<td><form name="form1" method="get" action="">
		Passifs
		<? mk_list_table_class("compta_compte","","SELECT * FROM `cpt_comptes` WHERE (type LIKE 'Actif' AND groupe= '0') AND ( type LIKE 'Actif' AND no_pos_5!= '0')", "no", "libelle_admin", $db, FALSE, "champs"); ?>

		<input type="submit" name="Submit" value="voir">
</form></td>
				<td><form name="form1" method="get" action="">
		Charges
						<? mk_list_table_class("compta_compte","","SELECT * FROM `cpt_comptes` WHERE  type LIKE 'Charge' AND groupe= '0' ORDER BY `no_pos_1`,`no_pos_2`,`no_pos_3`,`no_pos_4`,`no_pos_5`,`no_pos_6`,`no_pos_7`,`no_pos_8`,`no_pos_9` ", "no", "libelle_admin", $db, FALSE, "champs"); ?>
		<input type="submit" name="Submit" value="voir">
</form></td>
				<td><form name="form1" method="get" action="">
		Produits<? mk_list_table_class("compta_compte","","SELECT * FROM `cpt_comptes` WHERE  type LIKE 'Produit' AND groupe= '0' ORDER BY `no_pos_1`,`no_pos_2`,`no_pos_3`,`no_pos_4`,`no_pos_5`,`no_pos_6`,`no_pos_7`,`no_pos_8`,`no_pos_9` ", "no", "libelle_admin", $db, FALSE, "champs"); ?>

		<input type="submit" name="Submit" value="voir">
</form></td>

		</tr>
</table>
Relevé des dernières transactions:<br>
<a href="?compta=1&compta_releve_debut=0">&lt;&lt;-</a> <a href="?compta=1&compta_releve_debut=<?
if ($_GET['compta_releve_debut']-$nombre>=0) 
{echo $_GET['compta_releve_debut']-$nombre;} 
else  
{echo "0";} 
?>">&lt;--</a> <a href="?compta=1&compta_releve_debut=<? echo $_GET['compta_releve_debut']+$nombre;  ?>">--&gt;</a><br>

<table cellpadding="2" border="0">
<?

$sql_journal="SELECT * FROM cpt_journal ORDER BY date DESC LIMIT ".$_GET['compta_releve_debut'].",$nombre";
$res_journal=mysql_query($sql_journal,$db);
$futur=0;
$ligne=1;
while($ligne_journal=mysql_fetch_object($res_journal))
	{

	if ($ligne_journal->date > date("Y-m-d H:i:s"))
		{
		$futur=1;
		}
	if ($ligne_journal->date <= date("Y-m-d H:i:s"))
		{
		$last=1;
		}

	if ($futur==1 && $last==1)
		{
		print "<tr><td colspan=2><img src=../images/compta.gif></td></tr>";
		$futur=0;
		}
		
		
	// recherche des libelleés des comptes
	$sql_credit="SELECT * FROM cpt_comptes WHERE no='$ligne_journal->no_compte_credit'";
	$res_credit=mysql_query($sql_credit,$db);
	$ligne_credit=mysql_fetch_object($res_credit);
	$sql_debit="SELECT * FROM cpt_comptes WHERE no='$ligne_journal->no_compte_debit'";
	$res_debit=mysql_query($sql_debit,$db);
	$ligne_debit=mysql_fetch_object($res_debit);
	
	if ($ligne_credit->no==$ligne_look_compte['no'])
		{
		$solde=$solde-$ligne_journal->somme;
		}
	else
		{
		$solde=$solde+$ligne_journal->somme;
		}
	//print "<tr><td>".format_datetime($ligne_journal->date,0)."</td><td>$ligne_journal->libelle</td><td>$ligne_journal->somme</td><td>$ligne_credit->libelle_public</td><td>$ligne_debit->libelle_public</td>";
	print "<tr><td>";
	
	/* print '<table border="0"  cellpadding="0" cellspacing="0">
	<tr><td width="5" height="12" background="../images/cpt_ang_hg.gif"></td><td width="400" colspan="3" align="center">'.$ligne_journal->date.' ('.$ligne_journal->id.')</td><td width="5" background="../images/cpt_ang_hd.gif"></td></tr>
	<tr><td height="20" background="../images/cpt_vert.gif"></td><td width="300"><a href="?compta_compte='.$ligne_debit->no.'">'.$ligne_debit->libelle_admin.' ('.$ligne_debit->type.')</a></td><td align="right">'.$ligne_journal->somme.'</td><td></td><td background="../images/cpt_vert.gif"></td></tr>
	<tr><td height="20" background="../images/cpt_vert.gif"></td><td width="300">&nbsp;&nbsp;&nbsp;&nbsp;<a href="?compta_compte='.$ligne_credit->no.'">'.$ligne_credit->libelle_admin.' ('.$ligne_credit->type.')</a></td><td></td><td align="right">'.$ligne_journal->somme.'</td><td background="../images/cpt_vert.gif"></td></tr>
	<tr><td height="20" background="../images/cpt_vert.gif"></td><td colspan="3"><i>'.$ligne_journal->libelle.' - '.$ligne_journal->commentaire.'</i></td><td background="../images/cpt_vert.gif"></td></tr>
	<tr><td height="12" background="../images/cpt_ang_bg.gif"></td><td colspan="3" background="../images/cpt_hor.gif"></td><td background="../images/cpt_ang_bd.gif"></td></tr>
	</table>'; */
	
	print'<table border="0"  cellpadding="0" cellspacing="0">
	<tr>
		<td width="5" height="12" background="../images/cpt_ang_hg.gif"></td>
		<td width="400" align="center">'.$ligne_journal->date.' ('.$ligne_journal->id.')</td>
		<td width="5" background="../images/cpt_ang_hd.gif"></td>
		<td width="50"></td>
		<td width="5"></td>
		<td width="50"></td>
		<td width="5"></td>
	</tr>
	<tr>
		<td height="20" background="../images/cpt_vert.gif"></td>
		<td><a href="?compta_compte='.$ligne_debit->no.'">'.$ligne_debit->libelle_admin.' ('.$ligne_debit->type.')</a></td>
		<td background="../images/cpt_vert.gif"></td>
		<td align="right">'.$ligne_journal->somme.'</td>
		<td background="../images/cpt_vert.gif"></td>
		<td></td>
		<td background="../images/cpt_vert.gif"></td>
	</tr>
	<tr>
		<td height="20" background="../images/cpt_vert.gif"></td>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;<a href="?compta_compte='.$ligne_credit->no.'">'.$ligne_credit->libelle_admin.' ('.$ligne_credit->type.')</a></td>
		<td background="../images/cpt_vert.gif"></td>
		<td></td>
		<td background="../images/cpt_vert.gif"></td>
		<td align="right">'.$ligne_journal->somme.'</td>
		<td background="../images/cpt_vert.gif"></td>
	</tr>
	<tr>
		<td height="20" background="../images/cpt_vert.gif"></td>
		<td ><i>'.$ligne_journal->libelle.' - '.$ligne_journal->commentaire.'</i></td>
		<td background="../images/cpt_vert.gif"></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
	<tr>
		<td height="12" background="../images/cpt_ang_bg.gif"></td>
		<td background="../images/cpt_hor.gif"></td>
		<td background="../images/cpt_ang_bd.gif"></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
	</tr>
</table>';
	print "</td></tr>";

	$ligne++;
	}
?>
</table>
<a href="?compta=1&compta_releve_debut=0">&lt;&lt;-</a> <a href="?compta=1&compta_releve_debut=<?
if ($_GET['compta_releve_debut']-$nombre>=0) 
{echo $_GET['compta_releve_debut']-$nombre;} 
else  
{echo "0";} 
?>">&lt;--</a> <a href="?compta=1&compta_releve_debut=<? echo $_GET['compta_releve_debut']+$nombre;  ?>">--&gt;</a>
<img src="../images/intero12.gif" width="12" height="12">